// components/rgb/rgb.js
Component({
  properties: {},
  options: {
    pureDataPattern: /^_/,
  },
  data: {
    _color: {
      r: 0,
      g: 0,
      b: 0,
    },
    fullColor: "0,0,0",
  },

  observers: {
    "_color.r,_color.g,_color.b": function (a, b, c) {
      // console.log(a, b, c);
      this.setData({
        fullColor: `${a},${b},${c}`,
      });
    },
  },
  methods: {
    itemClick(e) {
      let type = e.currentTarget.dataset.type;
      console.log(type)
      // return;
      this.data._color[type] += 20;
    },
    _randomColor() {
      this.setData({
        _color: {
          r: Math.floor(Math.random() * 256),
          g: Math.floor(Math.random() * 256),
          b: Math.floor(Math.random() * 256),
        },
      });
    },
  },
  pageLifetimes: {
    show() {
      // this._randomColor();
      // console.log(this,"@@@")
      this._randomColor();
    },
  },
});
